package com.example.xyr.myapplication.view

import android.app.Activity
import android.view.View

/**
 * Created by ylcf on 2018/8/24.
 */
class HeartFaomThread(activity: Activity) : Thread() {
    var no: Int = 0
    var bout: Int = 0
    lateinit var view: View
    var activity: Activity = activity

    constructor(activity: Activity, view: View, bout: Int) : this(activity) {
        this.view = view
        this.bout = bout
    }

    override fun run() {
        while (no <= bout) {
            if (view is PeriscopeLayout) {
                activity.runOnUiThread(Runnable {
                    kotlin.run {
                        (view as PeriscopeLayout).addHeart()
                    }
                })
            }
            no++
        }
    }


}